package madixin.t696;

class Solution {
    public int countBinarySubstrings(String s) {
        int count = 0;//总个数
        int cur = 1;//当前连续的次数
        int pre = 0;//前一段连续的次数

        for (int i = 0; i < s.length() - 1; i++) {
            if (s.charAt(i) == s.charAt(i + 1)) {
                cur++;
            } else {
                pre = cur;
                cur = 1;
            }

            if (pre >= cur) {
                count++;
            }
        }

        return count;
    }

    public static void main(String[] args) {
        Solution s = new Solution();
        System.out.println(s.countBinarySubstrings("00110011"));


    }
}
